package org.xt.setup;

import org.nutz.dao.Dao;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.Ioc;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.NutConfig;
import org.nutz.mvc.Setup;

public class MainSetup implements Setup{
	private final static Log log = Logs.get();
	
	@Override
	public void init(NutConfig nc) {
		initDb(nc);
	}
	
	@Override
	public void destroy(NutConfig nc) {
		
	}
	
	private void initDb(NutConfig nc){
		// 扫描实体类自动建表
		Ioc ioc = nc.getIoc();
		Dao dao = ioc.get(Dao.class);
		
		Daos.createTablesInPackage(dao, "org.xt.entity", false);
	}
}
